package tbdp.tool.container;

import java.util.Collections;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import tbdp.tool.spi.Reader;

/**
 * @author xbkaishui
 * @version $Id: ProcessorContainer.java, v 0.1 2017-06-17 下午4:18 xbkaishui Exp $$
 */
public class ReaderContainer {

    public static Map<String, Reader> readerContainer = new ConcurrentHashMap<String, Reader>();

    public static void addReader(Reader reader) {
        readerContainer.putIfAbsent(reader.getType(), reader);
    }

    public static Reader getReader(String type) {
        return readerContainer.get(type);
    }

    public static Map<String, Reader> getReaderContainer() {
        return Collections.unmodifiableMap(readerContainer);
    }
}
